#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int getluckypacket(vector<int>& v,int n,int pos,int sum,int multi)
{
	int count = 0;
	for (int i = pos; i < n; ++i)
	{
		sum += v[i];
		multi *= v[i];
		if (sum > multi)
		{
			count += 1 + getluckypacket(v, n, pos+1, sum, multi);
		}
		else if (v[i] == 1)
		{
			count += getluckypacket(v, n, pos + 1, sum, multi);
		}
		else
		{
			break;
		}
		sum -= v[i];
		multi /= v[i];

		while (i < n - 1 &&v[i] == v[i + 1])
		{
			i++;
		}
	}
	return count;
}
//int main()
//{
//	int n;
//	cin >> n;
//	vector<int> v;
//	v.resize(n, 0);
//	for (int i = 0; i < n; i++)
//	{
//		cin >> v[i];
//
//	}
//	sort(v.begin(), v.end());
//	unique(v.begin(), v.end());
//	cout << getluckypacket(v, n, 0, 0, 1) << endl;
//	return 0;
//}